<!-- HTML header for doxygen 1.8.8-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <!-- For Mobile Devices -->
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
        <meta name="generator" content="Doxygen 1.8.18"/>
        <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
        <title>HElib: /HElib/include/helib/keySwitching.h Source File</title>
        <!--<link href="tabs.css" rel="stylesheet" type="text/css"/>-->
        <script type="text/javascript" src="dynsections.js"></script>
        <link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
        <link href='https://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
		<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,100;1,700&family=Merriweather&family=Merriweather+Sans&family=Open+Sans&family=Poppins:ital@1&family=Roboto:ital,wght@0,400;1,300;1,900&display=swap" rel="stylesheet"> 
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
        <link href="jquery.smartmenus.bootstrap.css" rel="stylesheet">
        <script type="text/javascript" src="jquery.smartmenus.js"></script>
        <!-- SmartMenus jQuery Bootstrap Addon -->
        <script type="text/javascript" src="jquery.smartmenus.bootstrap.js"></script>
        <!-- SmartMenus jQuery plugin -->
    </head>
    <body style="font-family: 'Merriweather', serif;">
        <nav class="navbar navbar-default" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <a class="navbar-brand">HElib Implementing Homomorphic Encryption</a>
                </div>
            </div>
        </nav>
        <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
            <div class="content" id="content">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-12 panel " style="padding-bottom: 15px;">
                            <div style="margin-bottom: 15px;">
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_d0c4ae63660968bf6b1c77a1e8aecf95.html">helib</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">keySwitching.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="key_switching_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/* Copyright (C) 2012-2020 IBM Corp.</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * This program is Licensed under the Apache License, Version 2.0</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * (the &quot;License&quot;); you may not use this file except in compliance</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * with the License. You may obtain a copy of the License at</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> *   http://www.apache.org/licenses/LICENSE-2.0</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * Unless required by applicable law or agreed to in writing, software</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> * See the License for the specific language governing permissions and</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> * limitations under the License. See accompanying LICENSE file.</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160; </div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#ifndef HELIB_KEY_SWITCHING_H</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#define HELIB_KEY_SWITCHING_H</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160; </div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="preprocessor">#include &lt;climits&gt;</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="_double_c_r_t_8h.html">helib/DoubleCRT.h</a>&gt;</span></div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="_context_8h.html">helib/Context.h</a>&gt;</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="_ctxt_8h.html">helib/Ctxt.h</a>&gt;</span></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160; </div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacehelib.html">helib</a> {</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160; </div>
<div class="line"><a name="l00086"></a><span class="lineno"><a class="line" href="classhelib_1_1_key_switch.html">   86</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_key_switch.html">KeySwitch</a></div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;{</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00089"></a><span class="lineno"><a class="line" href="classhelib_1_1_key_switch.html#a5b8267d055a0224c42ef247ddc7057f9">   89</a></span>&#160;  <a class="code" href="classhelib_1_1_s_k_handle.html">SKHandle</a> <a class="code" href="classhelib_1_1_key_switch.html#a5b8267d055a0224c42ef247ddc7057f9">fromKey</a>; <span class="comment">// A handle for the key s&#39;</span></div>
<div class="line"><a name="l00090"></a><span class="lineno"><a class="line" href="classhelib_1_1_key_switch.html#ab051ee75017f2de075ed0aaf94f3210c">   90</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_key_switch.html#ab051ee75017f2de075ed0aaf94f3210c">toKeyID</a>;     <span class="comment">// Index of the key s that we are switching into</span></div>
<div class="line"><a name="l00091"></a><span class="lineno"><a class="line" href="classhelib_1_1_key_switch.html#a8651e62e5105034f136a63c7d9d823f6">   91</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_key_switch.html#a8651e62e5105034f136a63c7d9d823f6">ptxtSpace</a>;   <span class="comment">// either p or p^r</span></div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160; </div>
<div class="line"><a name="l00093"></a><span class="lineno"><a class="line" href="classhelib_1_1_key_switch.html#a1467771b15e14a274ce6dcb20399af13">   93</a></span>&#160;  std::vector&lt;DoubleCRT&gt; <a class="code" href="classhelib_1_1_key_switch.html#a1467771b15e14a274ce6dcb20399af13">b</a>; <span class="comment">// The top row, consisting of the bi&#39;s</span></div>
<div class="line"><a name="l00094"></a><span class="lineno"><a class="line" href="classhelib_1_1_key_switch.html#af4d2dcf11d6e9edfa769cdaa764f5a5f">   94</a></span>&#160;  NTL::ZZ <a class="code" href="classhelib_1_1_key_switch.html#af4d2dcf11d6e9edfa769cdaa764f5a5f">prgSeed</a>; <span class="comment">// a seed to generate the random ai&#39;s in the bottom row</span></div>
<div class="line"><a name="l00095"></a><span class="lineno"><a class="line" href="classhelib_1_1_key_switch.html#a635d31b573c39ab850ea8a5a9155d6ce">   95</a></span>&#160;  NTL::xdouble <a class="code" href="classhelib_1_1_key_switch.html#a635d31b573c39ab850ea8a5a9155d6ce">noiseBound</a>; <span class="comment">// high probability bound on noise magnitude</span></div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;  <span class="comment">// in each column</span></div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160; </div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;  <span class="keyword">explicit</span> <a class="code" href="classhelib_1_1_key_switch.html#a74d6cc93536febfff257b19fc63dc060">KeySwitch</a>(<span class="keywordtype">long</span> sPow = 0,</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;                     <span class="keywordtype">long</span> xPow = 0,</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;                     <span class="keywordtype">long</span> fromID = 0,</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;                     <span class="keywordtype">long</span> toID = 0,</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;                     <span class="keywordtype">long</span> p = 0);</div>
<div class="line"><a name="l00103"></a><span class="lineno"><a class="line" href="classhelib_1_1_key_switch.html#a3cd8c681d701db5837260703b7b73b00">  103</a></span>&#160;  <span class="keyword">explicit</span> <a class="code" href="classhelib_1_1_key_switch.html#a3cd8c681d701db5837260703b7b73b00">KeySwitch</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_s_k_handle.html">SKHandle</a>&amp; _fromKey,</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;                     <span class="keywordtype">long</span> fromID = 0,</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;                     <span class="keywordtype">long</span> toID = 0,</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;                     <span class="keywordtype">long</span> p = 0);</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160; </div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classhelib_1_1_key_switch.html#a70670acc9c59290c0e668455108aecec">operator==</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_key_switch.html">KeySwitch</a>&amp; other) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classhelib_1_1_key_switch.html#aa654d241726845e7a4b3c89ecf701596">operator!=</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_key_switch.html">KeySwitch</a>&amp; other) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160; </div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;  <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_key_switch.html#af5e067d1594615c8c3c44acb941e484f">NumCols</a>() <span class="keyword">const</span>;</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160; </div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;  <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="classhelib_1_1_key_switch.html">KeySwitch</a>&amp; <a class="code" href="classhelib_1_1_key_switch.html#afc9320fe88ca2cda85f04c362de85442">dummy</a>();</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classhelib_1_1_key_switch.html#a0d5b6037b48b01c67bf29b0ae19f16e0">isDummy</a>() <span class="keyword">const</span>;</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160; </div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_key_switch.html#a84794d2ce7f58d204b2d561b443dc9ba">verify</a>(<a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sk);</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160; </div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_key_switch.html#a9d0189576a8418468aa50e6f7e5e2ca8">readMatrix</a>(std::istream&amp; str, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_context.html">Context</a>&amp; context);</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160; </div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_key_switch.html#a6dd127dd7552981ab1a6b74d2f0a141b">read</a>(std::istream&amp; str, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_context.html">Context</a>&amp; context);</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_key_switch.html#a7d5aacb77d9bf361522e29811e8994ca">write</a>(std::ostream&amp; str) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;};</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;std::ostream&amp; <a class="code" href="namespacehelib.html#addc58993c7093dd07d98335bab200e82">operator&lt;&lt;</a>(std::ostream&amp; str, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_key_switch.html">KeySwitch</a>&amp; matrix);</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;<span class="comment">// We DO NOT have std::istream&amp; operator&gt;&gt;(std::istream&amp; str, KeySwitch&amp;</span></div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;<span class="comment">// matrix); instead must use the readMatrix method above, where you can specify</span></div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;<span class="comment">// context</span></div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160; </div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160; </div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;<span class="preprocessor">#define HELIB_KEYSWITCH_THRESH (50)</span></div>
<div class="line"><a name="l00138"></a><span class="lineno"><a class="line" href="key_switching_8h.html#a3838902c58164cdb58bee2043b2263bd">  138</a></span>&#160; </div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;<span class="preprocessor">#define HELIB_KEYSWITCH_MIN_THRESH (8)</span></div>
<div class="line"><a name="l00143"></a><span class="lineno"><a class="line" href="key_switching_8h.html#ad5770a5b60a665868babc5126ae07944">  143</a></span>&#160; </div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;<span class="keywordtype">long</span> <a class="code" href="namespacehelib.html#a4fb58a793bef4befd9d75d8852d8fc55">KSGiantStepSize</a>(<span class="keywordtype">long</span> D);</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160; </div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a4da7a89f85244e58f456a86832c46a27">addAllMatrices</a>(SecKey&amp; sKey, <span class="keywordtype">long</span> keyID = 0);</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160; </div>
<div class="line"><a name="l00154"></a><span class="lineno"><a class="line" href="namespacehelib.html#acd7803e7000d31eda4aa3af44bfe0ef0">  154</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#acd7803e7000d31eda4aa3af44bfe0ef0">addFewMatrices</a>(<a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey, <span class="keywordtype">long</span> keyID = 0);</div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160; </div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a3ace8477657e91faeb4c33824bab098d">addSome1DMatrices</a>(<a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey,</div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;                       <span class="keywordtype">long</span> bound = <a class="code" href="key_switching_8h.html#a3838902c58164cdb58bee2043b2263bd">HELIB_KEYSWITCH_THRESH</a>,</div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;                       <span class="keywordtype">long</span> keyID = 0);</div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160; </div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a8f3689b135fde2c843eed5ce0813a975">add1DMatrices</a>(<a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey, <span class="keywordtype">long</span> keyID = 0);</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160; </div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a63d75eed1d12814e2e858ab82e07d311">addBSGS1DMatrices</a>(<a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey, <span class="keywordtype">long</span> keyID = 0);</div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160; </div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a40b42a155c81c0507222ebca1f0a39f8">addSomeFrbMatrices</a>(<a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey,</div>
<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;                        <span class="keywordtype">long</span> bound = <a class="code" href="key_switching_8h.html#a3838902c58164cdb58bee2043b2263bd">HELIB_KEYSWITCH_THRESH</a>,</div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;                        <span class="keywordtype">long</span> keyID = 0);</div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160; </div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a62bfda232309a69cc3824e5323345073">addFrbMatrices</a>(<a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey, <span class="keywordtype">long</span> keyID = 0);</div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160; </div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#af9483c8e129d827f9b49f140a327dd15">addBSGSFrbMatrices</a>(<a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey, <span class="keywordtype">long</span> keyID = 0);</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160; </div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a0c3d6b66cd30aed055d9c5a6333eca7c">addMinimal1DMatrices</a>(<a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey, <span class="keywordtype">long</span> keyID = 0);</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#aa94886e3afbcd49800243fd7fdaedd39">addMinimalFrbMatrices</a>(<a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey, <span class="keywordtype">long</span> keyID = 0);</div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160; </div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_perm_network.html">PermNetwork</a>;</div>
<div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a7d420cdf0dc5b6968a8a89809cd5b5f3">addMatrices4Network</a>(<a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_perm_network.html">PermNetwork</a>&amp; net, <span class="keywordtype">long</span> keyID = 0);</div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160; </div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a96c1092ac50c752cc8577da03cf232d4">addTheseMatrices</a>(<a class="code" href="classhelib_1_1_sec_key.html">SecKey</a>&amp; sKey,</div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;                      <span class="keyword">const</span> std::set&lt;long&gt;&amp; automVals,</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;                      <span class="keywordtype">long</span> keyID = 0);</div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160; </div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;} <span class="comment">// namespace helib</span></div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160; </div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;<span class="preprocessor">#endif // HELIB_KEY_SWITCHING_H</span></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="aclasshelib_1_1_key_switch_html_a6dd127dd7552981ab1a6b74d2f0a141b"><div class="ttname"><a href="classhelib_1_1_key_switch.html#a6dd127dd7552981ab1a6b74d2f0a141b">helib::KeySwitch::read</a></div><div class="ttdeci">void read(std::istream &amp;str, const Context &amp;context)</div><div class="ttdoc">Raw IO.</div><div class="ttdef"><b>Definition:</b> keySwitching.cpp:234</div></div>
<div class="ttc" id="aclasshelib_1_1_key_switch_html_af4d2dcf11d6e9edfa769cdaa764f5a5f"><div class="ttname"><a href="classhelib_1_1_key_switch.html#af4d2dcf11d6e9edfa769cdaa764f5a5f">helib::KeySwitch::prgSeed</a></div><div class="ttdeci">NTL::ZZ prgSeed</div><div class="ttdef"><b>Definition:</b> keySwitching.h:94</div></div>
<div class="ttc" id="aclasshelib_1_1_key_switch_html_a70670acc9c59290c0e668455108aecec"><div class="ttname"><a href="classhelib_1_1_key_switch.html#a70670acc9c59290c0e668455108aecec">helib::KeySwitch::operator==</a></div><div class="ttdeci">bool operator==(const KeySwitch &amp;other) const</div><div class="ttdef"><b>Definition:</b> keySwitching.cpp:43</div></div>
<div class="ttc" id="a_double_c_r_t_8h_html"><div class="ttname"><a href="_double_c_r_t_8h.html">DoubleCRT.h</a></div><div class="ttdoc">Integer polynomials (elements in the ring R_Q) in double-CRT form.</div></div>
<div class="ttc" id="anamespacehelib_html_a96c1092ac50c752cc8577da03cf232d4"><div class="ttname"><a href="namespacehelib.html#a96c1092ac50c752cc8577da03cf232d4">helib::addTheseMatrices</a></div><div class="ttdeci">void addTheseMatrices(SecKey &amp;sKey, const std::set&lt; long &gt; &amp;automVals, long keyID=0)</div><div class="ttdoc">Generate specific key-switching matrices, described by the given set.</div><div class="ttdef"><b>Definition:</b> keySwitching.cpp:642</div></div>
<div class="ttc" id="aclasshelib_1_1_key_switch_html_a8651e62e5105034f136a63c7d9d823f6"><div class="ttname"><a href="classhelib_1_1_key_switch.html#a8651e62e5105034f136a63c7d9d823f6">helib::KeySwitch::ptxtSpace</a></div><div class="ttdeci">long ptxtSpace</div><div class="ttdef"><b>Definition:</b> keySwitching.h:91</div></div>
<div class="ttc" id="aclasshelib_1_1_key_switch_html_a1467771b15e14a274ce6dcb20399af13"><div class="ttname"><a href="classhelib_1_1_key_switch.html#a1467771b15e14a274ce6dcb20399af13">helib::KeySwitch::b</a></div><div class="ttdeci">std::vector&lt; DoubleCRT &gt; b</div><div class="ttdef"><b>Definition:</b> keySwitching.h:93</div></div>
<div class="ttc" id="anamespacehelib_html_acd7803e7000d31eda4aa3af44bfe0ef0"><div class="ttname"><a href="namespacehelib.html#acd7803e7000d31eda4aa3af44bfe0ef0">helib::addFewMatrices</a></div><div class="ttdeci">void addFewMatrices(SecKey &amp;sKey, long keyID=0)</div><div class="ttdoc">Generate matrices so every s(X^e) can be reLinearized in at most two steps.</div></div>
<div class="ttc" id="aclasshelib_1_1_key_switch_html"><div class="ttname"><a href="classhelib_1_1_key_switch.html">helib::KeySwitch</a></div><div class="ttdoc">Key-switching matrices.</div><div class="ttdef"><b>Definition:</b> keySwitching.h:87</div></div>
<div class="ttc" id="akey_switching_8h_html_a3838902c58164cdb58bee2043b2263bd"><div class="ttname"><a href="key_switching_8h.html#a3838902c58164cdb58bee2043b2263bd">HELIB_KEYSWITCH_THRESH</a></div><div class="ttdeci">#define HELIB_KEYSWITCH_THRESH</div><div class="ttdoc">Constant defining threshold above which a baby-set/giant-step strategy is used.</div><div class="ttdef"><b>Definition:</b> keySwitching.h:137</div></div>
<div class="ttc" id="aclasshelib_1_1_key_switch_html_a5b8267d055a0224c42ef247ddc7057f9"><div class="ttname"><a href="classhelib_1_1_key_switch.html#a5b8267d055a0224c42ef247ddc7057f9">helib::KeySwitch::fromKey</a></div><div class="ttdeci">SKHandle fromKey</div><div class="ttdef"><b>Definition:</b> keySwitching.h:89</div></div>
<div class="ttc" id="aclasshelib_1_1_s_k_handle_html"><div class="ttname"><a href="classhelib_1_1_s_k_handle.html">helib::SKHandle</a></div><div class="ttdoc">A handle, describing the secret-key element that &quot;matches&quot; a part, of the form s^r(X^t).</div><div class="ttdef"><b>Definition:</b> Ctxt.h:78</div></div>
<div class="ttc" id="aclasshelib_1_1_key_switch_html_af5e067d1594615c8c3c44acb941e484f"><div class="ttname"><a href="classhelib_1_1_key_switch.html#af5e067d1594615c8c3c44acb941e484f">helib::KeySwitch::NumCols</a></div><div class="ttdeci">unsigned long NumCols() const</div><div class="ttdef"><b>Definition:</b> keySwitching.cpp:71</div></div>
<div class="ttc" id="anamespacehelib_html_a4fb58a793bef4befd9d75d8852d8fc55"><div class="ttname"><a href="namespacehelib.html#a4fb58a793bef4befd9d75d8852d8fc55">helib::KSGiantStepSize</a></div><div class="ttdeci">long KSGiantStepSize(long D)</div><div class="ttdoc">Function that returns number of baby steps. Used to keep this and matmul routines &quot;in sync&quot;.</div><div class="ttdef"><b>Definition:</b> keySwitching.cpp:251</div></div>
<div class="ttc" id="anamespacehelib_html_a4da7a89f85244e58f456a86832c46a27"><div class="ttname"><a href="namespacehelib.html#a4da7a89f85244e58f456a86832c46a27">helib::addAllMatrices</a></div><div class="ttdeci">void addAllMatrices(SecKey &amp;sKey, long keyID=0)</div><div class="ttdoc">Maximalistic approach: generate matrices s(X^e)-&gt;s(X) for all e in Zm*.</div><div class="ttdef"><b>Definition:</b> keySwitching.cpp:261</div></div>
<div class="ttc" id="anamespacehelib_html_a8f3689b135fde2c843eed5ce0813a975"><div class="ttname"><a href="namespacehelib.html#a8f3689b135fde2c843eed5ce0813a975">helib::add1DMatrices</a></div><div class="ttdeci">void add1DMatrices(SecKey &amp;sKey, long keyID=0)</div><div class="ttdoc">Generate all matrices s(X^{g^i})-&gt;s(X) for generators g of Zm* /(p) and i&lt;ord(g). If g has different ...</div><div class="ttdef"><b>Definition:</b> keySwitching.cpp:542</div></div>
<div class="ttc" id="anamespacehelib_html_a62bfda232309a69cc3824e5323345073"><div class="ttname"><a href="namespacehelib.html#a62bfda232309a69cc3824e5323345073">helib::addFrbMatrices</a></div><div class="ttdeci">void addFrbMatrices(SecKey &amp;sKey, long keyID=0)</div><div class="ttdef"><b>Definition:</b> keySwitching.cpp:564</div></div>
<div class="ttc" id="aclasshelib_1_1_key_switch_html_aa654d241726845e7a4b3c89ecf701596"><div class="ttname"><a href="classhelib_1_1_key_switch.html#aa654d241726845e7a4b3c89ecf701596">helib::KeySwitch::operator!=</a></div><div class="ttdeci">bool operator!=(const KeySwitch &amp;other) const</div><div class="ttdef"><b>Definition:</b> keySwitching.cpp:66</div></div>
<div class="ttc" id="aclasshelib_1_1_key_switch_html_a3cd8c681d701db5837260703b7b73b00"><div class="ttname"><a href="classhelib_1_1_key_switch.html#a3cd8c681d701db5837260703b7b73b00">helib::KeySwitch::KeySwitch</a></div><div class="ttdeci">KeySwitch(const SKHandle &amp;_fromKey, long fromID=0, long toID=0, long p=0)</div></div>
<div class="ttc" id="aclasshelib_1_1_key_switch_html_ab051ee75017f2de075ed0aaf94f3210c"><div class="ttname"><a href="classhelib_1_1_key_switch.html#ab051ee75017f2de075ed0aaf94f3210c">helib::KeySwitch::toKeyID</a></div><div class="ttdeci">long toKeyID</div><div class="ttdef"><b>Definition:</b> keySwitching.h:90</div></div>
<div class="ttc" id="aclasshelib_1_1_key_switch_html_a0d5b6037b48b01c67bf29b0ae19f16e0"><div class="ttname"><a href="classhelib_1_1_key_switch.html#a0d5b6037b48b01c67bf29b0ae19f16e0">helib::KeySwitch::isDummy</a></div><div class="ttdeci">bool isDummy() const</div><div class="ttdef"><b>Definition:</b> keySwitching.cpp:73</div></div>
<div class="ttc" id="anamespacehelib_html"><div class="ttname"><a href="namespacehelib.html">helib</a></div><div class="ttdef"><b>Definition:</b> apiAttributes.h:21</div></div>
<div class="ttc" id="anamespacehelib_html_a0c3d6b66cd30aed055d9c5a6333eca7c"><div class="ttname"><a href="namespacehelib.html#a0c3d6b66cd30aed055d9c5a6333eca7c">helib::addMinimal1DMatrices</a></div><div class="ttdeci">void addMinimal1DMatrices(SecKey &amp;sKey, long keyID=0)</div><div class="ttdoc">These routines just add a single matrix (or two, for bad dimensions)</div><div class="ttdef"><b>Definition:</b> keySwitching.cpp:602</div></div>
<div class="ttc" id="anamespacehelib_html_a63d75eed1d12814e2e858ab82e07d311"><div class="ttname"><a href="namespacehelib.html#a63d75eed1d12814e2e858ab82e07d311">helib::addBSGS1DMatrices</a></div><div class="ttdeci">void addBSGS1DMatrices(SecKey &amp;sKey, long keyID=0)</div><div class="ttdef"><b>Definition:</b> keySwitching.cpp:547</div></div>
<div class="ttc" id="anamespacehelib_html_aa94886e3afbcd49800243fd7fdaedd39"><div class="ttname"><a href="namespacehelib.html#aa94886e3afbcd49800243fd7fdaedd39">helib::addMinimalFrbMatrices</a></div><div class="ttdeci">void addMinimalFrbMatrices(SecKey &amp;sKey, long keyID=0)</div><div class="ttdef"><b>Definition:</b> keySwitching.cpp:614</div></div>
<div class="ttc" id="a_ctxt_8h_html"><div class="ttname"><a href="_ctxt_8h.html">Ctxt.h</a></div><div class="ttdoc">Declarations of a BGV-type ciphertext and key-switching matrices.</div></div>
<div class="ttc" id="anamespacehelib_html_addc58993c7093dd07d98335bab200e82"><div class="ttname"><a href="namespacehelib.html#addc58993c7093dd07d98335bab200e82">helib::operator&lt;&lt;</a></div><div class="ttdeci">std::ostream &amp; operator&lt;&lt;(std::ostream &amp;s, const SKHandle &amp;handle)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:189</div></div>
<div class="ttc" id="anamespacehelib_html_a7d420cdf0dc5b6968a8a89809cd5b5f3"><div class="ttname"><a href="namespacehelib.html#a7d420cdf0dc5b6968a8a89809cd5b5f3">helib::addMatrices4Network</a></div><div class="ttdeci">void addMatrices4Network(SecKey &amp;sKey, const PermNetwork &amp;net, long keyID=0)</div><div class="ttdef"><b>Definition:</b> keySwitching.cpp:621</div></div>
<div class="ttc" id="aclasshelib_1_1_perm_network_html"><div class="ttname"><a href="classhelib_1_1_perm_network.html">helib::PermNetwork</a></div><div class="ttdoc">A full permutation network.</div><div class="ttdef"><b>Definition:</b> permutations.h:559</div></div>
<div class="ttc" id="aclasshelib_1_1_key_switch_html_a635d31b573c39ab850ea8a5a9155d6ce"><div class="ttname"><a href="classhelib_1_1_key_switch.html#a635d31b573c39ab850ea8a5a9155d6ce">helib::KeySwitch::noiseBound</a></div><div class="ttdeci">NTL::xdouble noiseBound</div><div class="ttdef"><b>Definition:</b> keySwitching.h:95</div></div>
<div class="ttc" id="a_context_8h_html"><div class="ttname"><a href="_context_8h.html">Context.h</a></div><div class="ttdoc">Keeps the parameters of an instance of the cryptosystem.</div></div>
<div class="ttc" id="aclasshelib_1_1_key_switch_html_a84794d2ce7f58d204b2d561b443dc9ba"><div class="ttname"><a href="classhelib_1_1_key_switch.html#a84794d2ce7f58d204b2d561b443dc9ba">helib::KeySwitch::verify</a></div><div class="ttdeci">void verify(SecKey &amp;sk)</div><div class="ttdoc">A debugging method.</div><div class="ttdef"><b>Definition:</b> keySwitching.cpp:75</div></div>
<div class="ttc" id="anamespacehelib_html_a40b42a155c81c0507222ebca1f0a39f8"><div class="ttname"><a href="namespacehelib.html#a40b42a155c81c0507222ebca1f0a39f8">helib::addSomeFrbMatrices</a></div><div class="ttdeci">void addSomeFrbMatrices(SecKey &amp;sKey, long bound=HELIB_KEYSWITCH_THRESH, long keyID=0)</div><div class="ttdoc">Generate all/some Frobenius matrices of the form s(X^{p^i})-&gt;s(X)</div><div class="ttdef"><b>Definition:</b> keySwitching.cpp:553</div></div>
<div class="ttc" id="aclasshelib_1_1_sec_key_html"><div class="ttname"><a href="classhelib_1_1_sec_key.html">helib::SecKey</a></div><div class="ttdoc">The secret key.</div><div class="ttdef"><b>Definition:</b> keys.h:225</div></div>
<div class="ttc" id="aclasshelib_1_1_context_html"><div class="ttname"><a href="classhelib_1_1_context.html">helib::Context</a></div><div class="ttdoc">Maintaining the parameters.</div><div class="ttdef"><b>Definition:</b> Context.h:58</div></div>
<div class="ttc" id="aclasshelib_1_1_key_switch_html_a7d5aacb77d9bf361522e29811e8994ca"><div class="ttname"><a href="classhelib_1_1_key_switch.html#a7d5aacb77d9bf361522e29811e8994ca">helib::KeySwitch::write</a></div><div class="ttdeci">void write(std::ostream &amp;str) const</div><div class="ttdef"><b>Definition:</b> keySwitching.cpp:209</div></div>
<div class="ttc" id="anamespacehelib_html_a3ace8477657e91faeb4c33824bab098d"><div class="ttname"><a href="namespacehelib.html#a3ace8477657e91faeb4c33824bab098d">helib::addSome1DMatrices</a></div><div class="ttdeci">void addSome1DMatrices(SecKey &amp;sKey, long bound=HELIB_KEYSWITCH_THRESH, long keyID=0)</div><div class="ttdoc">Generate some matrices of the form s(X^{g^i})-&gt;s(X), but not all. For a generator g whose order is la...</div><div class="ttdef"><b>Definition:</b> keySwitching.cpp:527</div></div>
<div class="ttc" id="aclasshelib_1_1_key_switch_html_a9d0189576a8418468aa50e6f7e5e2ca8"><div class="ttname"><a href="classhelib_1_1_key_switch.html#a9d0189576a8418468aa50e6f7e5e2ca8">helib::KeySwitch::readMatrix</a></div><div class="ttdeci">void readMatrix(std::istream &amp;str, const Context &amp;context)</div><div class="ttdoc">Read a key-switching matrix from input.</div><div class="ttdef"><b>Definition:</b> keySwitching.cpp:192</div></div>
<div class="ttc" id="aclasshelib_1_1_key_switch_html_a74d6cc93536febfff257b19fc63dc060"><div class="ttname"><a href="classhelib_1_1_key_switch.html#a74d6cc93536febfff257b19fc63dc060">helib::KeySwitch::KeySwitch</a></div><div class="ttdeci">KeySwitch(long sPow=0, long xPow=0, long fromID=0, long toID=0, long p=0)</div><div class="ttdef"><b>Definition:</b> keySwitching.cpp:32</div></div>
<div class="ttc" id="aclasshelib_1_1_key_switch_html_afc9320fe88ca2cda85f04c362de85442"><div class="ttname"><a href="classhelib_1_1_key_switch.html#afc9320fe88ca2cda85f04c362de85442">helib::KeySwitch::dummy</a></div><div class="ttdeci">static const KeySwitch &amp; dummy()</div><div class="ttdoc">returns a dummy static matrix with toKeyId == -1</div><div class="ttdef"><b>Definition:</b> keySwitching.cpp:174</div></div>
<div class="ttc" id="anamespacehelib_html_af9483c8e129d827f9b49f140a327dd15"><div class="ttname"><a href="namespacehelib.html#af9483c8e129d827f9b49f140a327dd15">helib::addBSGSFrbMatrices</a></div><div class="ttdeci">void addBSGSFrbMatrices(SecKey &amp;sKey, long keyID=0)</div><div class="ttdef"><b>Definition:</b> keySwitching.cpp:569</div></div>
<!-- HTML footer for doxygen 1.8.8-->
<!-- start footer part -->
</div>
</div>
</div>
</div>
</div>
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
        <script type="text/javascript" src="doxy-boot.js"></script>
</html>
